<template>
  <view>
    <view class="">
      <uni-notice-bar showIcon="true" scrollable single text="因转专业等原因导致成绩的学分互认状态为需要学分互认的,和已有成绩的课程性质(课程组三级标签)不在培养方案学分结构内的会显示在待互认学分列表，请进行学分互认!"></uni-notice-bar>
    </view>
    <view>
      <uni-card :title="scoreData.xm" :extra="scoreData.xh" note="Tips">
        <view class="nav">
          <view class="banji">
            {{scoreData.bjmc}}
          </view>
          <view class="major">
            {{scoreData.xymc}}
          </view>
        </view>
        <view class="credit-totle">
          总学分<text>{{scoreData.yxxf}}</text> / 已修学分<text>{{scoreData.yhdxf}}</text> /
          学习中<text>{{scoreData.yxxf - scoreData.yhdxf}}</text>
        </view>
      </uni-card>
    </view>
    <view>
      <uni-list>
        <uni-collapse>
          <uni-collapse-item title="成长必修" :open="true">
            <view class="list-item">
                  <text class="list-item-title">成长必修学分</text>
                  <text class="rightText">{{scoreData.czbxxf}}</text>
            </view>
          </uni-collapse-item>
          <uni-collapse-item title="公共必修" :open="true">
            <view class="list-item">
                  <text class="list-item-title">公共必修学分</text>
                  <text class="rightText">{{scoreData.ggbxxf}}</text>
            </view>
            <view class="list-item">
                  <text class="list-item-title">公共选修学分</text>
                  <text class="rightText">{{scoreData.ggxxxf}}</text>
            </view>
          </uni-collapse-item>
          <uni-collapse-item title="专业必修" :open="true">
            <view class="list-item">
                  <text class="list-item-title">专业必修学分</text>
                  <text class="rightText">{{scoreData.zyxxxf}}</text>
            </view>
          </uni-collapse-item>
          <uni-collapse-item title="专业选修" :open="true">
            <view class="list-item">
                  <text class="list-item-title">专业选修学分</text>
                  <text class="rightText">{{scoreData.zyxxxf}}</text>
            </view>
          </uni-collapse-item>
        </uni-collapse>
      </uni-list>
    </view>
  </view>
</template>

<script>
  import {
    encrypt
  } from '@/utils/encryp.js'
  import getUser from "@/u_api/getUserInfo.js"
  export default {
    data() {
      return {
        jwtcode: "",
        scoreData: "",
        name: "",
        userData: {
          id: '',
          jwloginToken: ''
        }
      }
    },
    onShow() {
      this.getData();
    },
    methods: {
      async getData() {
        // this.userData.id = uni.getStorageSync('user').actualId;
        // this.userData.jwloginToken = uni.getStorageSync('jwt')

        // console.log(this.userData.id);
        // console.log("jwt:" + this.userData.jwloginToken);

        // this.request({
        //   url: 'jw-amsi/AmsJxbXsZgcj/listXs', // 路径
        //   method: 'GET', // 请求方法
        //   data: this.userData // 请求参数
        // }).then(res => {
        //   console.log(res); 
        //   // this.scoreData = res.msg.list[0]
        // })
        
        let userInfo = uni.getStorageSync('userInfo')
        if(!userInfo){  
        	userInfo = await getUser.getUserInfo();
        	uni.setStorageSync('userInfo',userInfo);
        }
        this.scoreData = userInfo
        
        console.log(userInfo);
      }
    }
  }
</script>

<style>
  .nav {
    display: flex;
    justify-content: space-between;
  }

  .credit-totle {
    margin-top: 20rpx;
  }

.list-item{
  padding-bottom: 20rpx;
  margin-left:60rpx;
  margin-right:30rpx;
  color: #aaa;
  display: flex;
  justify-content: space-between;
}

</style>